Class sjl.Stack
All Packages Class Hierarchy This Package Previous Next Index
Class sjl.Stack
java.lang.Object
|
+----sjl.Stack
- public class Stack
- extends Object
Stack
is a container adapter that provides a
last-in, first-out protocol to the elements in the
container. The container must implement the
BackInsertContainer interface.
The Vector
, List
and Deque
containers implements the BackInsertContainer
interface.
Copyright © 1996 Finn Bock
- See Also:
- Vector, Deque, List
-
Stack(BackInsertContainer)
- Construct a new Stack based on the container argument.
-
empty()
- Returns
true
if the stack does not contain any elements.
-
equals(Object)
- Compare the elements in this container with the elements
in another container.
-
pop()
- Returns and removes the top element on the stack.
-
push(Object)
- Insert a new element on the top of the Stack..
-
size()
- Returns the number of elements stored in the vector.
-
top()
- Return the top element of the Stack.
Stack
public Stack(BackInsertContainer container)
- Construct a new Stack based on the container argument.
equals
public boolean equals(Object container)
- Compare the elements in this container with the elements
in another container.
- Returns:
-
true
is the elements match.
- Overrides:
- equals in class Object
size
public int size()
- Returns the number of elements stored in the vector.
empty
public boolean empty()
- Returns
true
if the stack does not contain any elements.
pop
public void pop()
- Returns and removes the top element on the stack.
push
public void push(Object o)
- Insert a new element on the top of the Stack..
top
public Object top()
- Return the top element of the Stack. Undefined if the stack is empty.
All Packages Class Hierarchy This Package Previous Next Index